#include <cstdio>
#include <algorithm>
using namespace std;

int x[1005];
bool flag[1005];

int main() {
	int n, r;
	scanf("%d %d", &n, &r);

	//printf("\n**%d %d**\n", n, r);

	for (int i = 1; i <= n; ++i) {
		scanf("%d", x + i);
	}

	sort(x + 1, x + n + 1);

	int np;
	for (int i = 1; i <= n; ++i) {
		np = 1;
		while (np < i) {
			if (x[np] >= x[i] - r && flag[np]) goto END; 
			++np;
		}
		while (!flag[np] && np < n && x[np+1] <= x[i] + r) ++np;
		flag[np] = 1;
		END:;
	}

	int ans = 0; 
	for (int i = 1; i <= n; ++i) {
		if (flag[i]) ++ans;
	}
	
	printf("%d\n", ans);
	return 0;
}